www.gusucode.com > AspFaq在线帮助系统 V1.0 > AspFaq在线帮助系统 V1.0\code\admin\Templet_Case.asp

    <!--#include file="Include.asp"--><%
Types=request.QueryString("Type")
If Types=1 Then
	set fso=server.CreateObject("scripting.filesystemobject")
	application.Lock()
	'判断文件是否存在
	if fso.fileExists(server.MapPath("../Skin/"&Site_Templet&"/Index.html"))=False Then
	  Call ShowErr("首页文件未找到!","1")
	End If
	if fso.fileExists(server.MapPath("../Skin/"&Site_Templet&"/List.html"))=False Then
	  Call ShowErr("列表页文件未找到!","1")
	End If
	if fso.fileExists(server.MapPath("../Skin/"&Site_Templet&"/List.html"))=False Then
	  Call ShowErr("内容页文件未找到!","1")
	End If
	if fso.fileExists(server.MapPath("../Skin/"&Site_Templet&"/Search.html"))=False Then
	  Call ShowErr("搜索页文件未找到!","1")
	End If
	if fso.fileExists(server.MapPath("../Skin/"&Site_Templet&"/Guest.html"))=False Then
	  Call ShowErr("搜索页文件未找到!","1")
	End If
	'更新首页模板缓存
	url="../Skin/"&Site_Templet&"/Index.html"
	strOut=ReadTextFile(server.MapPath(url),"utf-8") 
	sqlstr="select * from [Templet] where Templet_Type=1"
	rs.open sqlstr,conn,1,3
	if not rs.eof then
	  rs("Templet_Content")=strOut
	  rs.update
	else
	  rs.addnew
	  rs("Templet_Content")=strOut
	  rs("Templet_Type")=1
	  rs.update
	end if
	rs.close
	'更新列表页模板缓存
	url="../Skin/"&Site_Templet&"/List.html"
	strOut=ReadTextFile(server.MapPath(url),"utf-8") 
	sqlstr="select * from [Templet] where Templet_Type=2"
	rs.open sqlstr,conn,1,3
	if not rs.eof then
	  rs("Templet_Content")=strOut
	  rs.update
	else
	  rs.addnew
	  rs("Templet_Content")=strOut
	  rs("Templet_Type")=2
	  rs.update
	end if
	rs.close
	'更新内容页模板缓存
	url="../Skin/"&Site_Templet&"/Show.html"
	strOut=ReadTextFile(server.MapPath(url),"utf-8") 
	sqlstr="select * from [Templet] where Templet_Type=3"
	rs.open sqlstr,conn,1,3
	if not rs.eof then
	  rs("Templet_Content")=strOut
	  rs.update
	else
	  rs.addnew
	  rs("Templet_Content")=strOut
	  rs("Templet_Type")=3
	  rs.update
	end if
	rs.close
	'更新搜索页模板缓存
	url="../Skin/"&Site_Templet&"/Search.html"
	strOut=ReadTextFile(server.MapPath(url),"utf-8") 
	sqlstr="select * from [Templet] where Templet_Type=4"
	rs.open sqlstr,conn,1,3
	if not rs.eof then
	  rs("Templet_Content")=strOut
	  rs.update
	else
	  rs.addnew
	  rs("Templet_Content")=strOut
	  rs("Templet_Type")=4
	  rs.update
	end if
	rs.close
	'更新留言页模板缓存
	url="../Skin/"&Site_Templet&"/Guest.html"
	strOut=ReadTextFile(server.MapPath(url),"utf-8") 
	sqlstr="select * from [Templet] where Templet_Type=5"
	rs.open sqlstr,conn,1,3
	if not rs.eof then
	  rs("Templet_Content")=strOut
	  rs.update
	else
	  rs.addnew
	  rs("Templet_Content")=strOut
	  rs("Templet_Type")=5
	  rs.update
	end if
	rs.close
	application.UnLock()	
	Call ShowErr("模板样式更改成功!","Templet_Case.asp?Menu=3&Menu2=2")
End If

function checkstr(str)
	str=replace(str,"'","&#39;")
	str=replace(str,"""","&quot;")
	str=replace(str,"<","&lt;")
	str=replace(str,">","&gt;")
	checkstr=str
end function

function getstr(strv)
	getstr=""
end function

FOR Each item in Request.QueryString
	Execute item & "=checkstr(Request.QueryString("""&item&"""))"
Next

FOR Each item in Request.Form
	Execute item & "=checkstr(Request.Form("""&item&"""))"
Next
If left(folder,7)<>"../Skin" Then
  folder="../Skin"
End If
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>模板文件管理--<%=Site_Name%></title>
<link rel="stylesheet" href="Images/Style.css" type="text/css" media="all" />
<link type="text/css" rel="stylesheet" rev="stylesheet" href="css/css.css" media="all">
<style>
a{color:#333333; text-decoration:none; font-size:12px;}

#folder{margin-bottom:0px;margin-left:30px;}
#folder li{ background-image:url(Pic/aurl.gif); background-position:0 2px; line-height:20px; list-style:none; background-repeat:no-repeat; text-indent:24px; font-size:12px; color:#333333;}
#folder li span{ display:block; float:left;}

#file{margin-top:3px;margin-left:31px;}
#file li{background-image:url(Pic/file.gif); background-position:0 3px;line-height:20px;list-style:none;background-repeat:no-repeat; text-indent:24px; font-size:12px; color:#333333;}
#file li span{ display:block; float:left;}
</style>
</head>

<body>
<div id="wrap">
<!--#Include file="Head.asp"-->
  <div id="main">
    <h2><span>模板文件管理&nbsp;&nbsp;[<a href="Templet_Case.asp?Type=1" class="a1">更新模板缓存</a>]&nbsp;&nbsp;!!每次修改模板文件后必须更新模板缓存!!</span></h2>
    <div class="explain">
      </div>
<% 
Sub files(path)
    FoldPath=Server.Mappath(path)
    set fso = Server.CreateObject("Scripting.FileSystemObject")
    set fsoFolder=fso.GetFolder(FoldPath)
    set objSubFolders=fsoFolder.Subfolders

	Response.Write "<ul id='folder'>"
    for each objSubFolder in objSubFolders
        Response.Write "<li><span style='width:280px;'><a href=Templet_Case.asp?Menu=3&Menu2=2&folder="&folder&"/"&server.URLEncode(objSubFolder.name)&">"&objSubFolder.name&"</a></span></li>"
    Next
    
	Response.Write "</ul><ul id='file'>"
    Set GetFiles =fsoFolder.files
    For Each f in fsoFolder.files
        Response.Write "<li><span style='width:180px; cursor:pointer;' onclick=yl('"&folder&"','"&f.Name&"')>"&f.Name& "</span><span style='width:100px;'>" &Formatnumber(f.size/1024,2,-1)&" KB</span> "
		if fso.GetExtensionName(f.Name)="txt" or fso.GetExtensionName(f.Name)="htm" or fso.GetExtensionName(f.Name)="html" or fso.GetExtensionName(f.Name)="css" or fso.GetExtensionName(f.Name)="js"or fso.GetExtensionName(f.Name)="asp" then Response.Write " <a href='Templet_Edit.asp?Menu=3&Menu2=2&folder="&folder&"&url="&folder&"/"&server.URLEncode(f.Name)&"'>[编辑]</a> "
		Response.Write "</li>"
    Next
	Response.Write "</ul>"
    Set fsoFolder = Nothing
    Set fso = Nothing
End Sub

if instr(folder,"/")>0 then
	url = split(folder,"/")
	if folder=session("folder") then
		burl = ""
	else
		burl = "/"&url(ubound(url))
	end if
	aurl = replace(folder,burl,"")
else
	aurl = folder
end if
%>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  	<td height="25" width="3%" valign="top"><img src="Pic/aurl.gif"></td><td colspan="2"><a href="Templet_Case.asp?Menu=3&Menu2=2&folder=<%=aurl%>&insert=<%=insert%>">上层目录</a> &nbsp;</td>
  </tr>
  <tr>
	<td colspan="2" valign="top" style="border-top:1px #585858 solid; padding-top:5px; border-bottom:1px #585858 solid; padding-bottom:5px; height:330px;">
		<%files(folder)%>&nbsp;
    </td>
    <td style="border-top:1px #585858 solid; padding-top:5px; border-bottom:1px #585858 solid; padding-bottom:5px;">&nbsp;</td>
  </tr>
</table>
<br />
  </div>
  <!--#Include file="Foot.asp"-->
<!--#Include file="Show_Go.asp"-->
</div>
</body>
</html>